<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器</title>
</head>
<script>
    const xiyou = ['唐僧','孙悟空','猪八戒','沙僧']
    for (let v of xiyou) {
        //数组的值
        console.log('of-' + v)
    }
    for (let v in xiyou) {
        //数组的下标
        console.log('in-' + v)
    }
    console.log(xiyou)
    
    let iterator = xiyou[Symbol.iterator]()
    console.log(iterator.next())
    console.log(iterator.next())
    console.log(iterator.next())
    console.log(iterator.next())
</script>
</html>